#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class ObjectView;
class Document;
class AbstractObject;

class QStackedWidget;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    QPointer<ObjectView> objectView() const;
    QPointer<QStackedWidget> editorsStackedWidget() const;
    QPointer<QMenu> objectsMenu() const;
private:
    bool askToSave();
    bool attemptToSaveDocument(QPointer<Document> doc);
    bool save();
    bool saveAs();

    void setupToolbar();

    Ui::MainWindow *ui;
    QPointer<ObjectView> m_objectView;
    QPointer<QStackedWidget> m_editorsStackedWidget;
private slots:
    void closeEvent(QCloseEvent * pEvent);
    void on_actionNew_Project_triggered();
    void on_actionOpen_triggered();
    void on_actionSave_As_triggered();
    void on_actionSave_triggered();
    void on_actionClose_Project_triggered();
    void on_actionExit_triggered();

    void on_actionNew_Graphics_Object_triggered();
    void on_actionNew_Animation_triggered();
    void on_actionDeleteObject_triggered();
    void on_actionNew_Texture_triggered();

    void on_actionPhysicsSimulator_triggered();

public slots:
    void updateGUI();
    void updateMenuCreateObject(QPointer<AbstractObject> selectedObject);

    void onCurrentObjectChanged(QPointer<AbstractObject> currentObject);
    void onCurrentFilenameChanged(QString fileName);
};

#endif // MAINWINDOW_H
